package com.fzy.common.tree;

import java.util.List;

/**
 * 树形节点
 *
 * @author 冯赵杨
 * @create 2018/9/27
 */
public class TreeNode {

    private int id;
    private int pid;
    private String name;

    /**
     * 扩展字段
     */
    private String attr1;
    private String attr2;
    private String attr3;
    private String label;
    private String value;
    private List<TreeNode> children;

    public TreeNode(int id, int pid, String name) {
        this.id = id;
        this.pid = pid;
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getPid() {
        return pid;
    }

    public void setPid(int pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<TreeNode> getChildren() {
        return children;
    }

    public void setChildren(List<TreeNode> children) {
        this.children = children;
    }

    public TreeNode addAttr1(String attr1) {
        this.attr1 = attr1;
        return this;
    }

    public TreeNode addAttr2(String attr2) {
        this.attr2 = attr2;
        return this;
    }

    public TreeNode addAttr3(String attr3) {
        this.attr3 = attr3;
        return this;
    }

    public TreeNode addLabel(String label) {
        this.label = label;
        return this;
    }

    public TreeNode addValue(String value) {
        this.value = value;
        return this;
    }

    public String getAttr1() {
        return attr1;
    }

    public void setAttr1(String attr1) {
        this.attr1 = attr1;
    }

    public String getAttr2() {
        return attr2;
    }

    public void setAttr2(String attr2) {
        this.attr2 = attr2;
    }

    public String getAttr3() {
        return attr3;
    }

    public void setAttr3(String attr3) {
        this.attr3 = attr3;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }


    @Override
    public String toString() {
        return "TreeNode{" +
                "id=" + id +
                ", pid=" + pid +
                ", name='" + name + '\'' +
                ", attr1='" + attr1 + '\'' +
                ", attr2='" + attr2 + '\'' +
                ", attr3='" + attr3 + '\'' +
                ", label='" + label + '\'' +
                ", value='" + value + '\'' +
                ", children=" + children +
                '}';
    }
}
